home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
ai
/
prlg195b.lzh
/
CHART.LZH
/
TEST01.PRO
< prev
next >
Wrap
Text File
|
1987-03-31
|
1KB
|
52 lines
/*
File: test01.pro
Author: Peter Ross
Updated: 3 June 1985
This file contains a sample grammar for use with the chart parser
in the file chart.pro. This example is very crude indeed. A slightly
more interesting example (the same grammar, but using compound terms
as categories) can be found in test02.pro.
============ SAMPLE GRAMMAR ============
*/
initial_category(trial,s).
strategy(trial,S) :-
prompt(_,'Strategy (td/bu): '),
read(S),
member(S,[td,bu]),
!.
strategy(trial,S) :-
write('Answer td. or bu. please'), nl,
strategy(trial,S).
policy(trial,P) :-
prompt(_,'Policy (bf/df): '),
read(P),
member(P,[bf,df]),
!.
policy(trial,P) :-
write('Answer df. or bf. please'), nl,
policy(trial,P).
rule(trial, s, [np, vp]).
rule(trial, np, [det, n]).
rule(trial, np, [np, pp]).
rule(trial, vp, [v]).
rule(trial, vp, [v, np]).
rule(trial, vp, [v, np, pp]).
rule(trial, pp, [p, np]).
lexical(trial, the, [det]).
lexical(trial, a, [det]).
lexical(trial, man, [n,v]).
lexical(trial, women, [n]).
lexical(trial, park, [n]).
lexical(trial, telescope, [n]).
lexical(trial, in, [p]).
lexical(trial, with, [p]).
lexical(trial, saw, [n,v]).
lexical(trial, likes, [v]).